<template>
	<view>
	 <form @submit="formSubmit" @reset="formReset">

		<page-head :title="title"></page-head>
			<view class="uni-textarea" >
				<textarea name="content"  placeholder="请输入反馈内容"/>
			</view>
			
		 <view class="uni-form-item uni-column">
		                    <view class="title">建议选项：</view>
		                    <radio-group name="type" v-model="radio">
		                        <label>
		                            <radio value="1" checked="true" /><text>对服务事项的建议</text>
		                        </label>
								<view></view>
		                        <label>
		                            <radio value="2" /><text>对淄博社会经济发展的建议</text>
		                        </label>
		                    </radio-group>
		   </view>
			 <button class="buttonBox" form-type="submit">提交</button>
			
		 </form>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				title: '建议内容',
				focus: false
			}
		},
		methods: {
			// 提交
			formSubmit: function(e) {
			        var formdata = e.detail.value
					uni.request({
						url: this.websiteUrl+'/api/index/feedback',
						method: 'POST',
						data: formdata,
						header: {
						     "Content-Type": "application/x-www-form-urlencoded",
							 "token": uni.getStorageSync('username').token,
							 
						}, // 请求头
						success: res => {
							if	(res.data.code != 1){
								return uni.showToast({
									title:res.data.msg ? res.data.msg :'网络错误',
								});
							}
							uni.showToast({
								title:"登记成功",
								duration:2000,
								success() {
									// uni.switchTab({
									//     url: '/pages/index/index'
									// });
								}
							});
							
						},
						fail: () => {},
						complete: () => {
							
						}
					});
					
					
			 //        uni.showModal({
			 //         content: '表单数据内容：' + JSON.stringify(formdata),
			 //        showCancel: false
			 // });	
			}
		}
	}
</script>

<style>
	.buttonBox{
		width: 91%;
		margin: 0 auto;
		height: 84rpx;
		border-radius: 84rpx;
		color: white;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		bottom: 100rpx;
		left: 0;
		right: 0;
		background-color: #4a8be9;
	}
</style>